import os
import datetime
from PyCmpltrtok.common import get_dir_name_ext

if __name__ == '__main__':
    DIR, BASE, EXT = get_dir_name_ext(os.path.abspath(__file__))
    PATH = os.path.join(DIR, f'{BASE}.tmp.txt')
    with open(PATH, 'a', encoding='utf8', newline='\r\n') as f:
        # xdate = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f %z')
        xdate = datetime.datetime.now(datetime.timezone.utc).isoformat()
        print(xdate)
        f.write(xdate + '\n')  # right
        f.write(xdate + '\r\n')  # wrong
